package com.dachuang.canjiren.controller;


import com.dachuang.canjiren.service.VolunteerService;
import com.dachuang.canjiren.service.WorkService;
import com.dachuang.common.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author testjava
 * @since 2020-07-27
 */
@RestController
@RequestMapping("/canjiren/work")
public class WorkController {
    @Autowired
    private WorkService workService;

    @GetMapping("insertWork")
    R insertWork(@RequestParam(value = "userId",required = false) Integer userId,
                  @RequestParam(value = "mechanism",required = false) String mechanism,
                  @RequestParam(value = "name",required = false)String name,
                  @RequestParam(value = "demand",required = false)String demand,
                  @RequestParam(value = "mail",required = false)String mail,
                  @RequestParam(value = "introduce",required = false)String introduce,
                  @RequestParam(value = "phone",required = false)String phone,
                  @RequestParam(value = "matter",required = false)String matter,
                  @RequestParam(value = "wages",required = false)String wages,
                  @RequestParam(value = "state",required = false)Integer state){
        return workService.insertWork(userId, mechanism, name, demand, mail, introduce, phone,  matter, wages, state);
    }

    @GetMapping(value = "listWork")
    R listWork(){
        return workService.selectWork();
    }
}

